import redis
class MyRedis:
    def __init__(self,host,password,port,db):
        self.host = host
        self.password = password
        self.port = port
        self.db = db
        self.__redis = self.execute_redis()

    def set(self, key, value):
        return self.__redis.set(key,value)
    def get(self, key):
        if self.__redis.exists(key):
            return self.__redis.get(key)
        else:
            return None
    def execute_redis(self,decode_responses=True):
        r = redis.Redis(host=self.host, password=self.password, port=self.port, db=self.db, decode_responses=decode_responses)
        return r

if __name__ == '__main__':
    redis_info = {  "host":"118.24.3.40",
                    "password":"HK139bc&*",
                    "port":6379,
                    "db":14,
                    "decode_responses":True   #0-15
                    }
    r = MyRedis(redis_info.get("host"),redis_info.get("password"),redis_info.get("port"),redis_info.get("db"))
    print(r.get("hhh"))